package cc.idoone.spring_boot_hello.controller;

import cc.idoone.spring_boot_hello.config.ConfigurationDemo;
import cc.idoone.spring_boot_hello.config.ConfigurationFileInject;
import cc.idoone.spring_boot_hello.interceptors.LoginRequired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 运行应用：mvn spring-boot:run 或在IDE中运行 main()方法，在浏览器中访问 http://localhost:8080
 *
 * @author museummjhe@foxmail.com
 * @date 2017年7月11日
 */
@Controller
@RequestMapping("/simple")
public class HelloController {
	@Autowired
	ConfigurationDemo config1;
	@Autowired
	ConfigurationFileInject config2;

	@RequestMapping("/")
	@ResponseBody
	@LoginRequired
	public String index() {
		System.out.println(config1);
		System.out.println(config2);
		return "simple/ Index Page";
	}

	@RequestMapping(value = "/hello", method = RequestMethod.GET)
	@ResponseBody
	@LoginRequired
	public String hello() {
		return "simple/ Hello World!";
	}

}